#ifndef SPRITE_H
#define SPRITE_H

#include <string>
#include "Rect.h"
#include "Point.h"
#include "AnimationFilm.h"
#include "allegro5\allegro.h"
#include "LatelyDestroyable.h"

typedef int Dim;
typedef unsigned char byte;

using namespace std;

class Sprite {
protected:
    byte frameNo;
    Rect frameBox;
    Dim x,y;
	bool flip_h, flip_v;
    bool isVisible;
    AnimationFilm* currFilm;
	void *platform;
	void *stair;
	void *step;
	bool canMove;
	bool isFalling;
	bool isClimbing;
    //TileLayer*	myLayer;
public:
	Sprite (Dim _x, Dim _y, AnimationFilm* film);
    void SetFrame(byte i);
    byte GetFrame(void) const;
	Rect GetFrameBox(void) { return currFilm->GetFrameBox(frameNo); };
	Rect GetRect(void) const;
	void SetAnimationFilm(AnimationFilm *);
	virtual void ResetToDefaultFilm(void) {};
	void SetX(int _x) { x = _x; };
	int GetX(void) { return x; };
	void SetY(int _y) { y = _y; };
	int GetY(void) { return y; };
	void SetFlipH(bool _flip_h) { flip_h = _flip_h; };
	bool GetFlipH(void) { return flip_h; };
	void SetFlipV(bool _flip_v) { flip_v = _flip_v; };
	bool GetFlipV(void) { return flip_v; };
    void SetVisibility (bool v);
    bool IsVisible(void) const;
	void SetPlatform(void *p) { platform = p; };
	void *GetPlatform(void) { return platform; };
	void SetStep(void *s) { step = s; };
	void* GetStep(void) { return step; };
    bool CollisionCheck(Sprite* s);
	virtual void CollisionAction(Sprite* s) {};
	void Display(const Rect& da);
	virtual void Move(int x, int y);
	void EnableMovement (void) { canMove = true; };
	void DisableMovement (void) { canMove = false; };
	void EnableClimbing(void) { isClimbing = true; };
	void DisableClimbing(void) { isClimbing = false; }
};

#endif